<tagLib name="lbase"/>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>微信公众平台管理系统</title>
        <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
    <include file="Public:header" />
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5.js"></script>
    <![endif]-->
</head>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body class="">
    <!--<![endif]-->

    <!--顶部菜单-->
<include file="Public:navbar" />

<!--左侧导航条-->
<include file="Public:nav" />

<!--右侧整体区域-->
<div class="content">
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="row-fluid">
                <!--右侧栏目区域start-->
                <div class="block">
                    <a class="block-heading" data-toggle="collapse">用户消息查看</a>
                    <div class="block-body collapse in">

                        <div class="container-fluid" style="margin-top: 10px;">
                            <!--右侧栏目内容区域start-->
                            <div class="row">
                                <div class="span12">
                                    <div class="pull-left">
                                        <a class="btn btn-primary" href="{$pre_url}">返 回</a>
                                    </div>
                                </div>
                                <!--右侧字段区域start-->
                                <div class="span12" style="margin-top:10px;">
                                    <p>微信ID：{$list.0.wx_name}</p>
                                    <p>最后活动时间：{:time_format(time()-$list[0]['create_time'])}</p>
                                    <p>最后活动48小时内可回复消息给用户</p>
                                    <b>用户会话信息</b><p /><p />
                                    <p>
                                        <textarea style="width:400px;height: 50px;" id="reply_content"></textarea>
                                        <input type="hidden" name="wx_name" id="wx_name" value="{$list.0.wx_name}" />
                                    </p>
                                    <p><input type="button" value="回 复" name="reply_btn" id="reply_btn" /></p>
                                    <foreach name="list" item="vo">
                                        接收时间：{:get_date_full($vo['create_time'])}<p />
                                        接收内容：{$vo.content}
                                        <hr>
                                    </foreach>
                                </div>
                                <!--右侧字段区域end-->
                            </div>
                            <!--右侧栏目内容区域end-->
                        </div>

                    </div>
                </div>
                <!--右侧栏目区域end-->
            </div>
            <footer>
                <include file="Public:footer" />
            </footer>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $('#reply_btn').click(function() {
            var wx_name=$("#wx_name").val();
            var content=$("#reply_content").val();
            $.ajax({
                type: "POST", //请求方式
                url: app_url+"/user_message/reply_action",
                data: {wx_name:wx_name,content:content},
                dataType: 'json', //返回数据类型
                cache: false, //是否缓存
                timeout: 10000, //超时时间
                success: function(data) {
                    success_callback(data);
                },
                error: function() {
                    //错误信息
                }
            });
        });
        
        /**
         * 成功返回处理
         * @returns {undefined}
         */
        function success_callback(data){
            if(data.errcode==0){
                alert("消息发送成功！");
                $("reply_content").val('');
            }else{
                alert("消息发送失败：错误代码："+data.errcode+"，错误信息："+data.errmsg);
            }
        }
    });
</script>
</body>
</html>


